/* create by zgt */
@import '../../scssMixin/generateClassName2.module.scss';

//定义了 0-100的 margin和padding值得className
//(如需提高权重，加后缀："-important")例：
//z-margin-10;z-margin-10-important;
//z-margin-left-20;z-margin-left-20-important;
//z-padding-20;z-padding-10-important;
//z-padding-left-20;z-padding-left-20-important;

@mixin setMargin($name:'margin',$value:0,$p:'',$important:false){
    $marginPos:'';
        @if $p==''{
            $marginPos:'' ;
        }@else{
            $marginPos:'-'+$p;
        }
        $marginName:'';
        @if $important{
            $marginName:$name+$marginPos+'-'+$value+'-important';
        }@else{
            $marginName:$name+$marginPos+'-'+$value;
        }
        @include z($marginName,$global:true){
            @if $important{
                #{$name}#{$marginPos}:$value + px !important;
            }@else{
                #{$name}#{$marginPos}:$value + px ;
            }
        }
}


@mixin margins($v){
    $pos:'left','right','top','bottom';
    @each $p in $pos{
        //例：z-margin-left-20
        @include setMargin('margin',$v,$p);
        @include setMargin('margin',$v,$p,true);
        @if $v!=0 {
            //例：z-margin-left--20
            @include setMargin('margin',-$v,$p);
            @include setMargin('margin',-$v,$p,true);
        }
        //例：z-padding-left-20
        @include setMargin('padding',$v,$p);
        @include setMargin('padding',$v,$p,true);
    }
    //例：z-margin-20  
    @include setMargin('margin',$v,'');
    @include setMargin('margin',$v,'',true);
    //例：z-padding-20
    @include setMargin('padding',$v,'');
    @include setMargin('padding',$v,'',true);
}

@for $i from 0 through 50 {
    @include margins($i);
}
